import 'package:flutter/material.dart';
import 'package:get/get.dart';
import 'package:mall/constant/app_colors.dart';
import 'package:mall/constant/app_dimens.dart';

import 'package:mall/constant/app_strings.dart';
import 'package:mall/constant/text_style.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:mall/gen/r.dart';
import 'package:mall/router/route_names.dart';

class SubmitSuccessPage extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        title: Text(AppStrings.SUBMIT_SUCCESS),
        centerTitle: true,
      ),
      body: Container(
        color: AppColors.C_FFFFFF,
        alignment: Alignment.center,
        height: double.infinity,
        child: Column(
          children: [
            Padding(padding: EdgeInsets.only(top: 75)),
            Image.asset(
              R.image.success.path,
              width: ScreenUtil().setWidth(AppDimens.DIMENS_300),
              height: ScreenUtil().setWidth(AppDimens.DIMENS_300),
            ),
            Padding(padding: EdgeInsets.only(top: 22)),
            Text(
              AppStrings.SUBMIT_SUCCESS,
              style: FMTextStyle.color_222222_size_13,
            ),
            Padding(padding: EdgeInsets.only(top: 75)),
            Row(
              children: [
                Expanded(
                  child: Container(
                    margin: EdgeInsets.only(left: 15, right: 10),
                    child: ElevatedButton(
                      style: ButtonStyle(
                        backgroundColor: WidgetStateProperty.all(AppColors.C_FFFFFF),
                        elevation: WidgetStateProperty.all(0),
                        shape: WidgetStateProperty.all(
                          RoundedRectangleBorder(
                            side: BorderSide(color: AppColors.C_DBDBDB),
                            borderRadius: BorderRadius.all(
                              Radius.circular(AppDimens.DIMENS_30),
                            ),
                          ),
                        ),
                        overlayColor: WidgetStateProperty.resolveWith<Color?>(
                          (states) {
                            if (states.contains(WidgetState.pressed)) {
                              return AppColors.C_FFFFFF; // 替代 splashColor 和 highlightColor
                            }
                            return null; // 不更改默认值
                          },
                        ),
                      ),
                      onPressed: () => Get.offNamedUntil(MobileRouteNames.root, (route) => false),
                      child: Text(
                        AppStrings.BACK_HOME,
                        style: FMTextStyle.color_222222_size_13,
                      ),
                    ),
                  ),
                ),
                Expanded(
                  child: Container(
                    margin: EdgeInsets.only(left: 15, right: 10),
                    child: ElevatedButton(
                      style: ButtonStyle(
                        backgroundColor: WidgetStateProperty.all(AppColors.C_FFFFFF), // 背景颜色
                        elevation: WidgetStateProperty.all(0), // 阴影
                        shape: WidgetStateProperty.all(
                          RoundedRectangleBorder(
                            side: BorderSide(color: AppColors.C_DBDBDB), // 边框颜色
                            borderRadius: BorderRadius.all(
                              Radius.circular(AppDimens.DIMENS_30),
                            ),
                          ),
                        ),
                        overlayColor: WidgetStateProperty.resolveWith<Color?>(
                          (Set<WidgetState> states) {
                            if (states.contains(WidgetState.pressed)) {
                              return AppColors.C_FFFFFF.withOpacity(0.2); // 按下时的颜色
                            }
                            return null; // 默认颜色
                          },
                        ),
                      ),
                      // onPressed: () => Navigator.of(context)
                      //     .pushNamedAndRemoveUntil(Routers.orderPage, ModalRoute.withName(Routers.root)),
                      onPressed: () => Get.offNamedUntil(MobileRouteNames.orderPage, (route) => false),
                      child: Text(
                        AppStrings.CHECK_BILL,
                        style: FMTextStyle.color_222222_size_13,
                      ),
                    ),
                  ),
                )
              ],
            ),
          ],
        ),
      ),
    );
  }
}
